--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c.orig
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
@@ -1155,15 +1155,27 @@
 		 */
 		ASSERT3P(zp, !=, NULL);
 		ASSERT3U(zp->z_id, ==, obj_num);
-		*zpp = zp;
-		vp = ZTOV(zp);
-
-		/* Don't let the vnode disappear after ZFS_OBJ_HOLD_EXIT. */
-		VN_HOLD(vp);
+		if (zp->z_unlinked) {
+			err = SET_ERROR(ENOENT);
+		} else {
+			vp = ZTOV(zp);
+			/*
+			 * Don't let the vnode disappear after
+			 * ZFS_OBJ_HOLD_EXIT.
+			 */
+			VN_HOLD(vp);
+			*zpp = zp;
+			err = 0;
+		}
 
 		sa_buf_rele(db, NULL);
 		ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
 
+		if (err) {
+			getnewvnode_drop_reserve();
+			return (err);
+		}
+
 		locked = VOP_ISLOCKED(vp);
 		VI_LOCK(vp);
 		if ((vp->v_iflag & VI_DOOMED) != 0 &&
@@ -1196,7 +1208,7 @@
 		}
 		VI_UNLOCK(vp);
 		getnewvnode_drop_reserve();
-		return (0);
+		return (err);
 	}
 
 	/*
